package com.net.xpay.common.manager.impl;

import com.google.common.base.Preconditions;
import com.net.common.dao.BasicMapper;
import com.net.xpay.common.dao.UserRegistrationMapper;
import com.net.xpay.common.domain.UserRegistration;
import com.net.xpay.common.manager.UserRegistrationManager;
import com.net.common.manager.AbstractManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class UserRegistrationManagerImpl extends AbstractManager<UserRegistration> implements UserRegistrationManager {

    @Autowired
    private UserRegistrationMapper mapper;


    @Override
    protected BasicMapper<Long, UserRegistration> getMapper() {
        return mapper;
    }

    @Override
    public UserRegistration getByUserId(Long userId) {
        Preconditions.checkArgument(userId != null);
        UserRegistration condition = new UserRegistration();
        condition.setUserId(userId);
        return getByCondition(condition);
    }
}
